{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--BOOK_INFORMATION-->\n",
    "<img align=\"left\" style=\"padding-right:10px;\" src=\"figures/PHydro-cover-small.png\">\n",
    "*This is the Jupyter notebook version of the [Python in Hydrology](http://www.greenteapress.com/pythonhydro/pythonhydro.html) by Sat Kumar Tomer.*\n",
    "*Source code is available at [code.google.com](https://code.google.com/archive/p/python-in-hydrology/source).*\n",
    "\n",
    "*The book is available under the [GNU Free Documentation License](http://www.gnu.org/copyleft/fdl.html). If you have comments, corrections or suggestions, please send email to satkumartomer@gmail.com.*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--NAVIGATION-->\n",
    "< [3D Plots](07.05-3D Plots.ipynb) | [Contents](Index.ipynb) | [Q-Q Plot](07.07-Q-Q-Plot.ipynb) >"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 7.6 箱形图\n",
    "\n",
    "箱形图是图形可视化数据统计特征的一种方法。它提供了最小值、第一个四分位(Q1)、中值(Q2)、上四分位(Q3)、最大值和异常值(如果存在)的信息。`boxplot`用于绘制箱形图。图7.9显示了箱形图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAGUtJREFUeJzt3X1wVNXdB/Dvz00CBV+wJCDynrHTBlYDZnnJA6QNwVFRAmM1GCsUTUtBGyMiERpspDbTDjoqg7YUCRixCVV5GcUR4SlByGgICe8YRUFAAhr0ETGBYJL9PX8QGRFCbsi9e/fsfj8zO0C4nPudVb6cnD33XlFVEBGROS5zOwAREbU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6IRAJYDuDfFyptAFDVharqU1VfTEyM9bRERNQqLRa3nLkzSz6ASlV9xvlIRER0MVZm3MMATAAwUkS2N71GO5yLiIia0eKHk6paAsD6vROJiMhRvFcJEZFhHLnkXUSOAQj2bSXRAL50O0QI4ftpL76f9jLh/eytqpZ2djhS3CYQkXKrW2+oZXw/7cX3016h9n5yqYSIyDAsbiIiw4RzcS90O0CI4ftpL76f9gqp9zNs17iJiEwVzjNuIiIjhV1xi8hiEakWET5SxAYi0lNEikWkUkT2iEiW25lMJSLtRaRMRHY0vZdz3M4UCkTEIyLbRGS121nsEnbFDeAlALe4HSKE8EEb9jkNYKSqxgMYAOAWERnqcqZQkIUzzxEIGWFX3Kq6EcD/uZ0jVPBBG/bRM2qafhnZ9OKHUG0gIj0A3AZgkdtZ7BR2xU3O4YM22q7p2/rtAKoBrFNVvpdt8xyAbJx5Xm7IYHGTLZoetLEcwMOqesLtPKZS1UZVHQCgB4DBIuJ1O5OpROR2ANWqWuF2FruxuKnNrDxog1pHVY8D2AB+HtMWwwCkisgBAMtw5tbUr7gbyR4sbmoTPmjDPiISIyKdmn7+EwCjAHzobipzqeosVe2hqn0A3A1gvare63IsW4RdcYtIEYD3AfxcRA6LSIbbmQzHB23YpxuAYhHZCWALzqxxh8wWNrIPr5wkIjJM2M24iYhMx+ImIjIMi5uIyDAsbiIiw7C4iYgMw+ImIjIMi5uIyDAsbiIiw/w/7V2R45n2zk0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x220dfeaa9e8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "n = 4\n",
    "x = range(4)\n",
    "y = 5 + np.random.randn(100,4)\n",
    "\n",
    "plt.boxplot(y,'D')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center>图7.9:箱形图数据</center>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
